#include("../../comm/ListHead.html")
<div class="layui-fluid layui-anim layui-anim-fadein">
    <div class="layui-row layui-col-space5">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="card-search SearchTable">
                    <p style="float:right">
                        <input type="text" id="task_id" placeholder="任务ID" class="table-search-text width80"/>
                        <input type="text" id="task_name" placeholder="任务名" class="table-search-text width200"/>
                        <button class="layui-btn layui-btn-warm layui-btn-sm" lay-event="DoSearch">
                            搜索
                        </button>
                    </p>
                    <div class="layui-tab layui-tab-brief">
                        <ul class="layui-tab-title" style="width: 300px;float:left">
                            <li lay-event="TurnTaskList"><i class="layui-icon layui-icon-date"></i> 定时任务列表</li>
                            <li class="layui-this"><i class="layui-icon layui-icon-time"></i> 任务日志</li>
                        </ul>
                    </div>
                </div>
                <div class="layui-card-body">
                    <table class="layui-hide" id="table_1" lay-filter="table_1"></table>

                    <script type="text/html" id="table_1_bar_title">
                        <div class="layui-btn-container" style="float:left;">
                            <button class="layui-btn layui-btn-sm btn-change-8" lay-event="EmptyTaskLog" value="365">
                                <i class="layui-icon">&#xe9aa;</i> 清空(1年前)
                            </button>
                            <button class="layui-btn layui-btn-sm btn-change-7" lay-event="EmptyTaskLog" value="30">
                                <i class="layui-icon">&#xe9aa;</i> 清空(1月前)
                            </button>
                            <button class="layui-btn layui-btn-sm layui-btn-disabled" permission-more="btn-del" lay-event="DelMoreOperLog" value="30">删除</button>
                        </div>
                        <div id="bar_desc">计划任务执行记录</div>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<script language="JavaScript">

    layui.use(['myTable', 'table', 'form', 'util', 'myTool', 'drawer'], function () {
        var $ = layui.$, myTable = layui.myTable, myTool = layui.myTool;
        /**
         * 表格
         */
        tableindex = layui.myTable.render({
            url: 'SysTaskLogListDataApi', title: '计划任务日志数据表'
            , cols: [[
                {type: 'checkbox', width: 36, fixed: true}
                , {field: 'log_id', title: 'ID', width: 80, align: 'center'}
                , {field: 'key1', title: '任务ID', align: 'left', width: 100}
                , {field: 'key2', title: '关键词2', align: 'left', width: 150, hide: true}
                , {field: 'log_title', title: '执行结果', align: 'left', width: 120}
                , {field: 'log_desc', title: '执行备注', align: 'left'}
                , {field: 'log_time', title: '执行时间', align: 'left', width: 160}
                , {field: 'log_ip', title: 'IP', align: 'left', width: 120}
            ]]
            , page: true, limit: 10
        });

        /**
         * 按钮事件
         */
        layui.util.event("lay-event", {
            DoSearch: function () {
                tableindex.reload({
                    where: {like: {key1: $("#key1").val()}}
                    , page: {curr: 1}
                });
            }
            , TurnTaskList: function () {
                window.location.href = "SysTaskList";
            }
        });

        //头工具栏事件
        layui.table.on('toolbar(table_1)', function (obj) {
            var days = layui.$(this).attr("value");
            layui.myTool.toolbar(this, obj, {
                EmptyTaskLog: function () {
                    index = top.layer.confirm('你是否确认清空【' + days + '】天以前的计划任务日志', {icon: 3, title: '提示', offset: '200px'}, function (index2) {
                        layui.myTool.postMsg("EmptyTaskLogApi", {days: days}, function () {
                            top.layer.close(index2);
                            tableindex.reload();
                        });
                    });
                }
                , DelMoreOperLog: function () {
                    myTool.doMoreSelect(layui.myTable.checkStatus('table_1'), {key: 'log_id'}, function (data, keys) {
                        index = top.layer.confirm('你是否确认批量删除选中的【' + data.length + '】计划任务日志', {icon: 3, title: '提示', offset: '150px'}, function (index2) {
                            myTool.postMsg("DelMoreyTaskLogApi", {
                                keys: keys
                            }, function () {
                                top.layer.close(index2);
                                tableindex.reload();
                            });
                        });
                    });
                }
            });
        });
        });
</script>
#include("../../comm/Foot.html")